package com.ztorn.services.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ztorn.mapper.UserMapper;
import com.ztorn.model.TWarehouse;
import com.ztorn.model.User;
import com.ztorn.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User findByUsername(String username) {
        User account = baseMapper.selectOne(new QueryWrapper<User>().eq("account", username));
        return account;
    }

    @Override
    public boolean save(User entity) {
        return super.save(entity);
    }

    @Override
    public TWarehouse getWareHouseByUserId(String account) {
        return userMapper.getWareHouseByUserId(account);
    }
}